﻿using Microsoft.Extensions.DependencyInjection;

namespace zijian666.DI;

/// <summary>
/// 启动器接口
/// </summary>
public interface ILauncher
{
    /// <summary>
    /// 调用启动类的 Configure 方法
    /// </summary>
    /// <param name="provider">参数提供程序</param>
    /// <param name="args">附加参数</param>
    /// <param name="cancellationToken">取消标识</param>
    /// <returns></returns>
    Task ConfigureAsync(IServiceProvider provider, object[]? args, CancellationToken cancellationToken);

    /// <summary>
    /// 调用启动类的 ConfigureServices 方法
    /// </summary>
    /// <param name="services">服务集合</param>
    /// <param name="args">附加参数</param>
    /// <param name="cancellationToken">取消标识</param>
    Task ConfigureServicesAsync(IServiceCollection services, object[]? args, CancellationToken cancellationToken);

    /// <summary>
    /// 调用启动类的 Stop 方法
    /// </summary>
    /// <param name="provider">参数提供程序</param>
    /// <param name="args">附加参数</param>
    /// <param name="cancellationToken">取消标识</param>
    /// <returns></returns>
    Task StopAsync(IServiceProvider provider, object[]? args, CancellationToken cancellationToken);
}